define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'clubmanage/clubmanage/index',
                    table: 'c_club',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                search:false,
                mobileResponsive: false, //是否自适应移动端
                columns: [
                    [
						{field: 'id', title: __('俱乐部ID')},
						{field: 'name', title: __('俱乐部名称')},
						{field: 'type', title: __('俱乐部类型'), searchList: {'1':'普通', '2': 'VIP'}},
						{field: 'owner', title: __('管理员ID'), operate: false},
						{field: 'nickname', title: __('管理员昵称'), operate: false},
						{field: 'diamond', title: __('俱乐部房卡余额'), operate: false},
						{field: 'roomcode', title: __('俱乐部总消耗'), operate: false},
						{field: 'usernum', title: __('俱乐部人数'), operate: false},
						{field: 'createTime', title: __('开通时间'),operate: 'RANGE', addclass: 'datetimerange', type: 'datetime'},
                    ]
                ],
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
            
			//俱乐部申请
			$("#club_examine").click(function(){
				window.location.href="/club/clubmanage/clubexamine/index";
			});
			
			//审核记录
			$("#club_log").click(function(){
				window.location.href="/club/clubmanage/clublog/index";
			});
			
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});